# coding: utf-8

import pygame
import random
from bullet import Bullet





# 死后重置
def reset(self):
	self.level = 0
	self.protected = False
	self.tank = pygame.image.load(self.tanks[self.level]).convert_alpha()
	self.tank_0 = self.tank.subsurface((0, 0), (48, 48))
	self.tank_1 = self.tank.subsurface((48, 0), (48, 48))
	self.rect = self.tank_0.get_rect()
	self.direction_x, self.direction_y = 0, -1
	if self.player == 1:
		self.rect.left, self.rect.top = 3 + 24 * 8, 3 + 24 * 24
	elif self.player == 2:
		self.rect.left, self.rect.top = 3 + 24 * 16, 3 + 24 * 24
	else:
		raise ValueError('myTank class -> player value error.')
	self.speed = 3



# 随机移动

# 重新载入坦克
def reload(self):
	self.tank = pygame.image.load(self.tanks[self.kind][self.color]).convert_alpha()
	self.tank_0 = self.tank.subsurface((0, 48), (48, 48))
	self.tank_1 = self.tank.subsurface((48, 48), (48, 48))